/*
 * @Descripttion: 
 * @version: 
 * @Author: yuanliutech
 * @Date: 2022-11-22 10:08:14
 * @LastEditors: yuanliutech@lwj
 * @LastEditTime: 2022-11-29 18:53:46
 */
const app = getApp()

import Dialog from '@vant/weapp/dialog/dialog';
import {
    showMsg
} from '../../../../../utils/config.js'
import {
    reqSpaceDel
} from '../../../../../request/api'
module.exports = Behavior({
    behaviors: [],
    properties: {},
    data: {},
    created: function () {},
    attached: function () {},
    ready: function () {},
    methods: {
        clickDelete() {
            let {
                listItemInfo,
                titleTip
            } = this.data
            Dialog.confirm({
                    title: '温馨提示',
                    message: `此操作将删除该${titleTip}，是否继续？`,
                })
                .then(async () => {
                    const res = await reqSpaceDel({
                        id:listItemInfo.id,
                        userId:app.globalData.userId
                    })
                    this.unShowMoreActions()
                    if (res.code != 20000) return showMsg(res.message);
                    this.getInitDataList()
                    showMsg("删除成功")
                })
                .catch(() => {});
        },
    }
})